package riceSystem.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import riceSystem.dao.DaoTemplateInterface;
import riceSystem.entity.Order;
import riceSystem.exception.RunException;
import riceSystem.service.ServiceTemplateInterface;
@Component("orderService")
public class OrderServiceImpl implements ServiceTemplateInterface<Order> {

	private DaoTemplateInterface<Order> orderDao;
	
	public DaoTemplateInterface<Order> getOrderDao() {
		return orderDao;
	}
	@Resource(name="orderDao")
	public void setOrderDao(DaoTemplateInterface<Order> orderDao) {
		this.orderDao = orderDao;
	}

	public void add(Order t) throws RunException {
		orderDao.save(t);
	}

	public void removeById(long id) throws RunException {
		orderDao.deleteById(id);
	}

	public void remove(Order t) throws RunException {
		orderDao.delete(t);
	}

	public long update(Order t) throws RunException {
		return orderDao.update(t);
	}

	public Order getById(long id) throws RunException {
		return orderDao.loadById(id);
	}

	public List<Order> getAll() throws RunException {
		return orderDao.loadAll();
	}

}
